#coding=utf-8

'''
@author: tongji
@contact: tongji@rekoo.com
'''

def init_data():
    '''初始化参数数据格式，具体哪个键记什么东西，由后端程序员确定'''
    return {'v1':None, 'v2':None, 'v3':None, 'v4':None, 'num':None}

#--------------------------------下面是要写的回调函数

def get_test_value(request, args):
    '''测试'''
    data = init_data()
    if args['before']['first_name'] == args['after']['first_name']:
        data['success'] = False
    else:
        data['v1'] = 100
        data['v2'] = 3000
        data['v3'] = 105
    return data

def get_buy_result(request, kwargs):
    ''''''
    data = init_data()
    delta_gold = abs(kwargs['after'].get('gold', 0) - kwargs['before'].get('gold', 0))
    data['v1'] = 'pingguo'
    data['v2'] = delta_gold
    return data
    